'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.createLogLevelFlags = createLogLevelFlags;

const LEVELS = ['silent', 'error', 'warning', 'info', 'debug', 'verbose'];

function createLogLevelFlags(levelLimit) {
  const levelLimitI = LEVELS.indexOf(levelLimit);

  if (levelLimitI === -1) {
    const msg = `Invalid log level "${levelLimit}" ` + `(expected one of ${LEVELS.join(',')})`;
    throw new Error(msg);
  }

  const flags = {};
  LEVELS.forEach((level, i) => {
    flags[level] = i <= levelLimitI;
  });
  return flags;
}
